import request from '@/utils/request.js'

// 巡检记录分页查询
export function getRecordData(query) {
	return request({
		url: `business/zdhjcInspectionTask/app/page`,
		method: 'get',
		params: query,
	})
}


// 分页获取项目列表
export function getProject(query) {
	return request({
		url: `business/project/page`,
		method: 'get',
		params: query
	})
}

// 获取项目详情
export function getProjectInfo(id) {
	return request({
		url: `business/project/info/` + id,
		method: 'get',
	})
}

// 巡检详情
export function getInspectionInfo(id) {
	return request({
		url: `business/zdhjcInspectionTask/app/` + id,
		method: 'get',
	})
}

// 获取单位
export function getOrgInfo(id) {
	return request({
		url: `admin/sysOrgInfo/find/` + id,
		method: 'get',
	})
}

// 获取子项目
export function getSubPorject(query) {
	return request({
		url: `business/project/subproject/page`,
		method: 'get',
		params: query
	})
}

// 获取子项目详情
export function getProInfo(id) {
	return request({
		url: `business/project/subproject/info/`+id,
		method: 'get',
	})
}


// 获取巡检模板
export function getInspectionTemp(query) {
	return request({
		url: `business/zdhjcInspectionTemplate/page`,
		method: 'get',
		params: query
	})
}

// 根据模板获取内容
export function getmubanInfo(id) {
	return request({
		url: `business/zdhjcInspectionTemplate/sub/`+id,
		method: 'get',
	})
}

// 提交保存
export function saveSubmit(obj) {
	return request({
		url: `business/zdhjcInspectionTask/app/saveOrUpdate`,
		method: 'post',
		params: obj
	})
}

// 文件上传
export function upload(obj, query) {
	return request({
		url: `admin/sys-file/upload`,
		method: 'post',
		params: query
	})
}


export function getFileById(id) {
	return request({
		url: `admin/sys-file/getFileById` + '?id=' + id,
		method: 'get',
		options: {
			responseType: 'arraybuffer',
		}
	})
}

export function getFileByIds(id) {
	return request({
		url: `admin/sys-file/getFileInfoByIds` + '?id=' + id,
		method: 'get',
		options: {
			responseType: 'arraybuffer',
		}
	})
}


